Project Overview :
β In this project we are reading all the XML files after labelling and make it into a single csv file so that we can use that to train the AI model.
Requirements :
β Raspberry Pi 3 Model B+ .
Initial setup for RPI-TENSORFLOW :
π Click Here , for the initial setup
SPECIFICATION :
Raspberry Pi 3 Model B+
The Raspberry Pi 3 Model B+ is the latest product in the Raspberry Pi 3 range, boasting a 64-bit quad core processor running at 1.4GHz, dual-band 2.4GHz and 5GHz wireless LAN, Bluetooth 4.2/BLE, faster Ethernet, and PoE capability.
The dual-band wireless LAN comes with modular compliance certification, allowing the board to be designed into end products with significantly reduced wireless LAN compliance testing, improving both cost and time to market.
β Processor: Broadcom BCM2837B0, Cortex-A53 64-bit SoC @ 1.4GHz .
β Memory: 1GB LPDDR2 SDRAM.
β Connectivity: 2.4GHz and 5GHz IEEE 802.11.b/g/n/ac wireless LAN, Bluetooth 4.2, BLE Gigabit Ethernet over USB 2.0 (maximum throughput 300Mbps) 4 Γ USB 2.0 ports.
β Access: Extended 40-pin GPIO header.
β Video & Sound: 1 Γ full size HDMI, MIPI DSI display port, MIPI CSI camera port, 4 pole stereo output and composite video port.
β Multimedia: H.264, MPEG-4 decodes (1080p30); H.264 encode (1080p30) OpenGL ES 1.1, 2.0 graphics.
β SD card support: Micro SD format for loading operating system and data storage.
β Input Power: 5V/3.1A DC via micro USB connector, 5V DC via GPIO header, Power over Ethernet (PoE)βenabled.
Pre requirement :
β Install required libraries from terminal .
-pip install pandas
-pip install xmltodict
Code :
import xmltodict import pandas as pd import os folder_path=r"/home/covailab/Desktop/data" img_file=[] xml_file=[] for file in os.listdir(folder_path): if file.endswith('.xml'): xml_file.append(file) elif file.endswith('.jpg'): img_file.append(file) print(xml_file) print(img_file) if len(img_file)==len(xml_file): print("numbers matching") for i in range (len(img_file)): if i ==0: path=folder_path+'/'+xml_file[i] with open(path) as xml_file1: data_dict = xmltodict.parse(xml_file1.read()) df=pd.json_normalize(data_dict) else: path=folder_path+'/'+xml_file[i] with open(path) as xml_file1: data_dict = xmltodict.parse(xml_file1.read()) df1=pd.json_normalize(data_dict) data1=pd.concat([df,df1]) df=data1 print(df) df.to_csv(folder_path+'/data.csv') else: print("numbers not matching")
β We have to replace the path of your data folder in folder_path.
OUTPUT :
β You can find the .csv in the same folder